package com.fzkj.shejimoshi.Singleton;

/**
 * 静态内部类实现单例模式  推荐
 */
public class PrivateStaticClass {

    private PrivateStaticClass(){}

    public static PrivateStaticClass getInstance(){
        return Holder.INSTANCE;
    }

    private static class Holder {
        static PrivateStaticClass INSTANCE = new PrivateStaticClass();
    }

    public static void main(String[] args) {
        System.out.println(PrivateStaticClass.getInstance());
        System.out.println(PrivateStaticClass.getInstance());
    }

}
